import { FC } from "react";
import { AudioOutlined } from "@ant-design/icons";
import { Input, Space } from "antd";
import type { GetProps } from "antd";

type SearchProps = GetProps<typeof Input.Search>;
import { useSearchParams } from "react-router-dom";

const { Search } = Input;
// const onSearch: SearchProps['onSearch'] = (value, _e, info) => console.log(info?.source, value);
const SearchInput: FC = () => {
  const [searchParams, setSearchParams] = useSearchParams();
  const onSearch: SearchProps["onSearch"] = (value: string) => {
    console.log(value);
    // const inputValue = searchParams.get("keyWord") || ""; // 获取查询参数

    // 更新查询参数
    setSearchParams({ keyWord: value });
  };
  return (
    <div>
      <Search
        allowClear
        placeholder="请输入搜索关键词"
        onSearch={onSearch}
        style={{ width: 400 }}
      />
    </div>
  );
};

export default SearchInput;
